<?php
 // ou le mettre ? 

abstract class gestion_des_donnees {
    
    private $mysql;

        function __construct() {
 require_once '../../config.php';
//CONNEXION SERVEUR MYSQL AVEC PDO
$pdo = new PDO($dsn, $username, $passwd);

        }
}

class gestion_des_donnees_pdo {
    
    static function afficherListingDonnees($table, $champs="*", $where=null, $order=null) {
        $sql = "SELECT $champs FROM $table $where $order";
        $req = $this->mysql->prepare($sql); 
        $req->execute(); 
        while ($data = $req->fetch(PDO::FETCH_ASSOC)) 
        { 
            $result[] = $data; 
        } return $result;
    }
    
    static function modifierDonnees($table, $champs, $where){
        $sql = "UPDATE ".$table." SET ".$champs." WHERE id=".$where;
    }
    
    static function supprimerDonnees($table, $champs, $where){
        $sql = "DELETE FROM ".$table." WHERE id=".$where;
    }
}

